﻿using System.Text;
using System.Web.Mvc;
using Wayloop.Blog.Core.Services;


namespace Wayloop.Blog.Presentation.Controllers
{
    public class FeedController : AbstractController
    {
        /// <summary>
        /// Gets or sets the <see cref="IFeedService"/> implementation.
        /// </summary>
        /// <value>The <see cref="IFeedService"/> implementation.</value>
        public IFeedService FeedService { get; private set; }


        /// <summary>
        /// Initializes a new instance of the <see cref="FeedController"/> class.
        /// </summary>
        /// <param name="feedService">The feed service.</param>
        public FeedController(IFeedService feedService)
        {
            FeedService = feedService;
        }


        [AcceptVerbs(HttpVerbs.Get)]
        public ActionResult Atom()
        {
            string feedContent = FeedService.GetAtomFeed();
            return Content(feedContent, "application/atom+xml", Encoding.Unicode);
        }
    }
}